package com.xindaoapp.happypet.shop.ui;

import android.content.Context;
import android.support.v4.view.PagerAdapter;
import android.support.v4.view.ViewPager;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.ImageView.ScaleType;

import com.xindaoapp.happypet.R;
import com.xindaoapp.happypet.utils.CommonParameter;

public class BannerAdapter extends PagerAdapter {

    private final Context mContext;

    public BannerAdapter(Context context) {
        this.mContext = context;
    }

    @Override
    public void destroyItem(ViewGroup container, int position, Object object) {
        ((ViewPager) container).removeView((View) object);
    }

    @Override
    public Object instantiateItem(ViewGroup container, int position) {
        ImageView iv = new ImageView(mContext);
        iv.setScaleType(ScaleType.FIT_XY);
        if (CommonParameter.isLoadImg) {
            // ImageLoader.getInstance().displayImage(imageUrlList.get(position %
            // dotList.size()),
            // iv);
        } else {
            iv.setImageResource(R.drawable.picture_loading);
        }
        container.addView(iv);
        return iv;
    }

    @Override
    public int getCount() {
        return 100000;
    }

    @Override
    public boolean isViewFromObject(View arg0, Object arg1) {
        return arg0 == arg1;
    }



}
